<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>修改手机号码风险标记</title>
	<jsp:include page="../../import.jsp" flush="true"/>
</head>
<body class="iframeBody">
<form id="rskTelSignLog_form">
	<div class="fieldset1 tabel_col tabel_col_1 clearFix">
		<div class="fieldBox col_50">
			<div class="label">手机号码</div>
			<div class="field">
				<input name="tel" id="tel" type="text" class="ui-textbox" value="${rskTelSignLogVO.tel}" validate="{required:true,mobile:true}" readonly="readonly">
			</div>
		</div>
		<div class="fieldBox col_50">
			<div class="label">创建时间</div>
			<div class="field">
				<input name="crtTm" id="crtTm" type="text" class="ui-textbox" value="${crtTm}" validate="{required:false,maxlength:30}" readonly="readonly">
				<span class="requiredSymbol">*</span>
			</div>
		</div>
		<div class="fieldBox col_50">
			<div class="label">标记类型</div>
			<div class="field">
				<input name="signResType" id="signResType" placeholder="请选择" ltype="combobox" validate="{required:true}">
				<span class="requiredSymbol">*</span>
			</div>
		</div>
		<div class="fieldBox col_50">
			<div class="label">创建人</div>
			<div class="field">
				<input name="crtUsrNm" id="crtUsrNm" type="text" class="ui-textbox" value="${rskTelSignLogVO.crtUsrNm}"
					   validate="{required:false,maxlength:30}" readonly="readonly">
				<span class="requiredSymbol">*</span>
			</div>
		</div>
		<div class="fieldBox col_50">
			<div class="label">状态</div>
			<div class="field">
				<input name="isValid" id="isValid" placeholder="请选择" ltype="combobox" validate="{required:true}">
				<span class="requiredSymbol">*</span>
			</div>
		</div>
		<div class="fieldBox col_50">
			<div class="label">更新时间</div>
			<div class="field">
				<input name="mdfTm" id="mdfTm" type="text" class="ui-textbox" value="${mdfTm}"
					   validate="{required:false,maxlength:30}" readonly="readonly">
			</div>
		</div>
		<div class="fieldBox col_50">
			<div class="label">标记原因</div>
			<div class="field">
				<input name="signRes" id="signRes" type="text" class="ui-textbox" value="${rskTelSignLogVO.signRes}" validate="{required:false,maxlength:60}">
			</div>
		</div>
		<div class="fieldBox col_50">
			<div class="label">更新标记人</div>
			<div class="field">
				<input name="mdfUsrNm" id="mdfUsrNm" type="text" class="ui-textbox" value="${currentUserName}"
					   validate="{required:true,maxlength:30}" readonly="readonly">
				<span class="requiredSymbol">*</span>
			</div>
		</div>
		<div class="fieldBox col_100">
			<div class="label">备注</div>
			<div class="field">
				<textarea name="signRem" id="signRem" class="ui-textarea l-textarea" value="" cols="120" rows="4">${rskTelSignLogVO.signRem}</textarea>
			</div>
		</div>
	</div>
	<div class="btnsBox">
		<span id="saveRskTelSignLog_Btn" class="sq-button sq-button-round l-dialog-btn-ok">保存</span>
		<span id="closeBtn" class="sq-button sq-button-round co_normal">关闭</span>
		<input type="reset" id="resetBtn" class="l-button l-button-reset Hide">
	</div>
</form>
<script>
    $(function() {
		$("#signResType").ligerComboBox({
			valueField: 'key',
			textField: 'value'
		});
        $("#isValid").ligerComboBox({
            valueField: 'key',
            textField: 'value'
        });
        $("#rskTelSignLog_form").ligerForm({
            validate: true
        });
        liger.get("signResType").setData(${signResTypeList});
        liger.get("isValid").setData(${isValidList});
		var signResType = "${rskTelSignLogVO.signResType}";
		var signResTypeNm = "${rskTelSignLogVO.signResTypeNm}";
		var isValid = "${rskTelSignLogVO.isValid}";
		var isValidNam = "有效";
		if(0 == isValid){
		    isValidNam = "无效";
		}
		$("#signResType").val(signResTypeNm);
		$("#signResType").selected = true;
		$("#isValid").val(isValidNam);
		$("#isValid").selected = true;

        /*保存*/
        $("#saveRskTelSignLog_Btn").click(function (event) {
            var form = liger.get("rskTelSignLog_form");
            if (!form.valid()) {
                $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO, SQ_type: "warning"});
                return false; //验证不通过，不执行以下代码
            }

            var signRem = $("#signRem").val();
            var signRenLength = getByteLen(signRem);
            if (signRenLength >= 255) {
                $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_SIGNREM_LENGTH, SQ_type: "warning"});
                return false; //验证不通过，不执行以下代码
            }

            var signRes = $("#signRes").val();
            var signResLength = getByteLen(signRes);
            if (signResLength >= 30) {
                $.ligerDialog.SQalert({content: "标记原因超过30字节", SQ_type: "warning"});
                return false; //验证不通过，不执行以下代码
            }

            var data = form.getData();
            if (data.signResType == null || data.signResType == '') {
                data["signResType"] = signResType;
            }
            if (data.isValid == null || data.isValid == '') {
                data["isValid"] = isValid;
            }
            $.ligerDialog.hide();
            var _url = '<%=path%>/risk/rskTelSignLog/modify.do';
            var wait_dialog;
            $.ajax({
                type: 'post',
                dataType: 'json',
                data: data,
                url: _url,
                beforeSend: function () {
                    wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
                },
                success: function (msg) {
                    wait_dialog.close();
                    if (msg.success == 1) {
                        $.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                        parent.$("#clearBtn").click();
                        parent.$("#searchBtn").click();
                        frameElement.dialog.close();
                    } else {
                        $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                    }
                }
            });
        });

        /*关闭*/
        $("#closeBtn").click(function (event) {
            frameElement.dialog.close();
        });
    });

    function getByteLen(str) {
        var len = 0;
        for (var i = 0; i < str.length; i++) {
            var a = str.charAt(i);
            if (a.match(/[^\x00-\xff]/ig) != null) {
                len += 2;
            } else{
                len += 1;
            }
        }
        return len;
    }


</script>
</body>
</html>
